package com.ccp.dev.system.controller;

import com.ccp.dev.core.basic.annotion.Action;
import com.ccp.dev.core.basic.consts.UrlConstants;
import com.ccp.dev.core.basic.internationalization.SysBaseController;
import com.ccp.dev.core.basic.model.SysAuditModelType;
import com.ccp.dev.core.util.RequestUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;


/**
 * ClassDescribe:各种选择器
 * @author :jiayueqiao
 * Date: 2019-07-10
 * Since:1
 */
@Controller
@Action(ownermodel = SysAuditModelType.NULL)
@RequestMapping(UrlConstants.PROJECT_ROOT+UrlConstants.PROJECT_MODULE_SYSTEM+"/dialog")
public class DialogController extends SysBaseController {

    /**
     * 用户选择器
     * @return
     */
    @Action(description="用户选择器页面跳转",exectype = "页面跳转日志")
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX+"/sysUserDialog")
    public String viewSysUserDialog(HttpServletRequest request, ModelMap modelMap){
        String dataPrivacyLevel= RequestUtil.getString(request,"dataPrivacyLevel");
        modelMap.put("dataPrivacyLevel",dataPrivacyLevel);
        return "dialog/sysUserDialog";
    }

    /**
     * 用户选择器
     * @return
     */
    @Action(description="用户选择器页面跳转",exectype = "页面跳转日志")
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX+"/sysUserDialogWithOrgName")
    public String sysUserDialogWithOrgName(){
        return "dialog/sysUserDialogWithOrgName";
    }

    /**
     * 用户单选选择器
     * @return
     */
    @Action(description="用户单选选择器页面跳转",exectype = "页面跳转日志")
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX+"/singleSysUserDialog")
    public String viewSingleSysUserDialog(HttpServletRequest request, ModelMap modelMap){
        String selectUserId= RequestUtil.getString(request,"selectUserId");
        String dataPrivacyLevel= RequestUtil.getString(request,"dataPrivacyLevel");
        modelMap.put("selectUserId",selectUserId);
        modelMap.put("dataPrivacyLevel",dataPrivacyLevel);
        return "dialog/singleSysUserDialog";
    }

    /**
     * 角色选择器
     * @return
     */
    @Action(description="角色选择器页面跳转",exectype = "页面跳转日志")
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX+"/sysRoleDialog")
    public String viewSysRoleDialog(){
        return "dialog/sysRoleDialog";
    }

    /**
     * 角色单选选择器
     * @return
     */
    @Action(description="角色单选选择器页面跳转",exectype = "页面跳转日志")
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX+"/singleSysRoleDialog")
    public String viewSingleSysRoleDialog(HttpServletRequest request, ModelMap modelMap){
        String selectRoleId= RequestUtil.getString(request,"selectRoleId");
        modelMap.put("selectRoleId",selectRoleId);
        return "dialog/singleSysRoleDialog";
    }

    /**
     * 组织选择器
     * @return
     */
    @Action(description="组织选择器页面跳转",exectype = "页面跳转日志")
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX+"/sysOrgDialog")
    public String viewSysOrgDialog(){
        return "dialog/sysOrgDialog";
    }

    /**
     * 组织单选选择器
     * @return
     */
    @Action(description="组织单选选择器页面跳转",exectype = "页面跳转日志")
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX+"/singleSysOrgDialog")
    public String viewSingleSysOrgDialog(HttpServletRequest request, ModelMap modelMap){
        String selectOrgId= RequestUtil.getString(request,"selectOrgId");
        modelMap.put("selectOrgId",selectOrgId);
        return "dialog/singleSysOrgDialog";
    }
}
